#include <bits/stdc++.h>

#define int long long

using namespace std;

void solve()
{
    int n;
    cin >> n;
    vector<int> arr(n + 10);
    for(int i = 1; i <= n; i ++)
    {
        cin >> arr[i];
    }
    sort(arr.begin() + 1,arr.begin() + 1 + n);
    
    int ans = 0;
    for(int i = n; i >= 1; i -= 2)
    {
        ans += arr[i];
    }
    cout << ans << endl;
}

signed main()
{
    int t;
    cin >> t;
    while(t --)
    {
        solve();
    }
}